import 'dart:ui' as ui;

import 'package:flutter/material.dart';
import 'package:flutter_ok/global.dart';
import 'package:flutter_ok/route/routes.dart';
import 'package:flutter_ok/util/util.dart';
import 'package:flutter_ok/value/value.dart';
import 'package:get/get.dart';

void main() async {
  await Global.init();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      title: 'Flutter Demo',
      theme: appTheme,
      enableLog: true,
      debugShowCheckedModeBanner: false,
      defaultTransition: Transition.cupertino,
      // 路由
      initialRoute: Routes.splash,
      getPages: Routes.getPages,
      routingCallback: (routing) => Routes.routingInterceptor(routing),
      // 语言国际化
      translations: Strings(),
      locale: ui.window.locale,
      fallbackLocale: Locale('en', 'US'),
      builder: (context, child) => Scaffold(
        body: GestureDetector(
          onTap: () => AppUtil.hideKeyboard(context),
          child: child,
        ),
      ),
    );
  }
}
